Skip to content

bot-gh: fix silent PR auto-assign no-op on old gh, request owner review - #121

Merged
robercano-ghbot merged 1 commit into
mainfrom
fix/bot-gh-assign-review-notify
Jul 15, 2026
Merged

bot-gh: fix silent PR auto-assign no-op on old gh, request owner review#121
robercano-ghbot merged 1 commit into
mainfrom
fix/bot-gh-assign-review-notify

Conversation

@robercano-ghbot

Copy link
Copy Markdown
Collaborator

Closes the notification gap: bot PRs were never assigned to the owner and never requested their review.

Root cause

bot-gh.sh's post-create follow-up used gh api -f "assignees[]=<owner>". The bracket array syntax doesn't exist on older gh releases (this box runs Ubuntu's packaged gh 2.4.0, 2022) — it sends a literal "assignees[]" string field, which the GitHub API ignores while returning 200. Exit code 0 → the soft-fail warning never fired → every bot PR since #33 landed shipped unassigned, silently. Verified live on PR #117: bracket-syntax call returns 200 with assignees: []; explicit-JSON call assigns correctly.

Fix

  1. Both follow-ups now send explicit JSON bodies via gh api --input - — works on any gh 2.x.
  2. Success is judged by the response naming the owner, not the exit code (the exit code is what lied here). Failure warns loudly on stderr.
  3. New second follow-up: request a formal review from the owner (POST /pulls/N/requested_reviewers), so the PR lands in their GitHub review queue and fires the review-requested notification. The author is always the bot, so GitHub's no-self-review-request rule can't trip.

Test

This PR is its own end-to-end test: it was created with the fixed script — check that it arrived assigned to @robercano with a review requested. Gates: self lint + test green in the worktree.

🤖 Generated with Claude Code

…review-request

The owner never got assigned to (or asked to review) any bot PR: the
follow-up used gh's `-f "assignees[]=..."` bracket-array syntax, which
older gh releases (e.g. Ubuntu 22.04's packaged 2.4.0) encode as a
literal "assignees[]" STRING field. GitHub ignores the unknown field and
still returns 200, so the soft-fail warning never fired — zero assigned
events on every PR since the feature landed (#33).

- Send both payloads as explicit JSON via `gh api --input -`
  (version-proof back to early gh 2.x).
- Verify the RESPONSE names the owner instead of trusting the exit code
  (the exit code is exactly what lied here); warn loudly otherwise.
- Add the missing second follow-up: request a formal review from the
  owner, so bot PRs land in their GitHub review queue and fire the
  review-requested notification. Author is always the bot, so the
  no-self-review-request rule cannot trip.

Verified live against PR #117: the bracket-syntax call returned 200 with
assignees untouched; the JSON-body call assigned the owner.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@robercano-ghbot
robercano-ghbot merged commit 99c9c7b into main Jul 15, 2026
9 checks passed
@robercano-ghbot
robercano-ghbot deleted the fix/bot-gh-assign-review-notify branch July 15, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants